﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;
using Xfm;
using Xfm.Core.Options;
using Xfm.TagHelpers;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class XfTagHelperExtension
    {
        /// <summary>
        /// 从文件创建菜单
        /// </summary>
        /// <param name="xfConfig"></param>
        /// <param name="key"></param>
        public static void AddNavMenu(this XfmConfig xfConfig, string key)
        {
            IXfmOption navOption = new XfJsonOption(typeof(NavModel), key);
            xfConfig.AddOption(navOption);
        }
        /// <summary>
        /// 从对象创建菜单
        /// </summary>
        /// <param name="xfConfig"></param>
        /// <param name="key"></param>
        /// <param name="navModel"></param>
        public static void AddNavMenu(this XfmConfig xfConfig, string key, NavModel navModel)
        {
            IXfmOption navOption = new XfJsonOption(navModel, key);
            xfConfig.AddOption(navOption);
        }
    }
}
